const reqlib = require('app-root-path').require
const numberUtil = reqlib('/app/util/numberUtil')
/**
 * 信号等级系列
 * 100: 下个就平仓
 * mini，small，normal，big，large
 * 0011
 */
module.exports = {
  // 下个k就平仓的
  sellIfOnlyPingByReasonPingNextKline () {
    if (this.marketFlagInfo.isMarketChaos && this.btbItem.price_change_percent < 60) {
      if (this.analysisInfo15m.netChangeRatio >= 12 && this.analysisInfo15m.macdUpDays <= 4) {
        // 很好的策略，效果确实挺好,就是以前的sellIfSpecialMarket-1
        this.setSellByReason('sellIfOnlyPingByReason-pnk-2', {
          level: 100,
          rate: 1,
          pingNextKline: true,
          useRawPosition: this.btbItem.price_change_percent < 60
        })
      }
      if (this.analysisInfo15m.netChangeRatio >= 20 && this.analysisInfo15m.ema5W10A20Days <= 4) {
        this.setSellByReason('sellIfOnlyPingByReason-pnk-2-1', {
          level: 100,
          rate: 1,
          pingNextKline: true,
          useRawPosition: this.btbItem.price_change_percent < 60
        })
      }
    }
    if (
      this.marketInfo.kdj4hBad &&
      !(this.marketInfo.kdj1dGood)
    ) {
      if (
        this.analysisInfo15m.netChangeRatio >= 12 &&
        // 或者说小于等于3
        this.analysisInfo15m.macdUpDays <= 4 &&
        // 超过的话就有点危险了
        this.btbItem.price_change_percent < 60
      ) {
        this.setSellByReason('sellIfOnlyPingByReason-pnk-3', {
          level: 100,
          rate: 1,
          pingNextKline: true,
          useRawPosition: true
        })
      }
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo1h.netChangeRatio >= 25 &&
      // 或者350
      this.analysisInfo1h.ema5W10A20KeepInfo.maxCloseRate >= 300 &&
      // 或者380
      this.analysisInfo1h.ema5W10A20KeepInfo.maxHighRate >= 300 &&
      this.analysisInfo1h.ema5W10A20Days >= 32 &&
      this.analysisInfo15m.ema5W10A20Days >= 32 &&
      this.analysisInfo15m.macd > 0 &&
      this.analysisInfo15m.macdUpDays <= 4 &&
      this.analysisInfo15m.netChangeRatio >= 15 &&
      // 或者20
      this.analysisInfo15m.highOpenRate >= 17.5
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-pnk-5', {
        level: 100,
        rate: 1,
        pingNextKline: true,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      // 或者12
      this.analysisInfo15m.highOpenRate > 10 &&
      // 或者-15
      this.analysisInfo15m.netChangeRatio < -10 &&
      this.analysisInfo15m.ema5W10A20Days >= 1
    ) {
      // 在24h涨幅比较大的时候，好像效果不太行
      // 原来的sellIfOnlyPingByReason-p-0
      this.setSellByReason('sellIfOnlyPingByReason-pnk-6', {
        level: 100,
        rate: 1,
        pingNextKline: true,
        useRawPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatioList[1] >= 15 &&
      this.analysisInfo15m.highOpenRate > 15 &&
      this.analysisInfo15m.netChangeRatio < 2 &&
      (this.analysisInfo15m.netChangeRatio / this.analysisInfo15m.highLowRate) <= 0.1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-pnk-7', {
        level: 100,
        rate: 1,
        pingNextKline: true,
        useRawPosition: true
      })
    }
  },
  // 5<10;kdj<0;
  sellIfOnlyPingByReasonMini () {
    let avRate = this.analysisInfo15m.before10DaysAvMaxWave
    if (avRate < 0.3) {
      avRate = 0.3
    }
    // 一个k线涨的，波动是之前20倍，然后回落了35%那就要做空，一直拿到5小于10
    if (
      this.analysisInfo15m.netChangeRatio > 10 &&
      this.analysisInfo15m.netChangeRatio / avRate > 10 &&
      this.analysisInfo15m.highLowRate / avRate > 20 &&
      (this.analysisInfo15m.netChangeRatio / this.analysisInfo15m.highLowRate) <= 0.7
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.highOpenRate > 7.5 &&
      this.analysisInfo15m.netChangeRatio < -1 &&
      this.analysisInfo15m.ema5 > this.analysisInfo15m.ema10 &&
      this.analysisInfo15m.kdjDiff < 0 &&
      this.isDayChangeTime
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-13', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.lastNetChangeRatioUpDays >= 11 &&
      this.analysisInfo15m.lastNetChangeRatioUpRate >= 150 &&
      // 后续可以配合kdj在下
      this.analysisInfo15m.netChangeRatioDownDays === 1
    ) {
      // 连涨的，暂时没有用最大仓位
      this.setSellByReason('sellIfOnlyPingByReason-16', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: this.analysisInfo15m.kdjDiff < 0
      })
    }
    if (
      this.analysisInfo15m.netChangeRatioList[1] >= 50 &&
      this.analysisInfo15m.netChangeRatioList[0] >= 10 &&
      this.analysisInfo15m.highOpenRate >= 15
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-21-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.ema5W10A20Days >= 16 &&
      // 或者大于240
      this.analysisInfo15m.ema5W10A20KeepInfo.maxHighRate >= 200 &&
      // this.btbItem.price_change_percent >= 160 &&
      // 或者55
      this.analysisInfo4h.netChangeRatio >= 45 &&
      this.is4hLargeChangeTime
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-22', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.highOpenRate > 12 &&
      this.analysisInfo15m.netChangeRatio < 0 &&
      this.analysisInfo15m.kdjDownDays === 1 &&
      this.analysisInfo15m.ema5A10A20Days >= 1 &&
      this.analysisInfo15m.macd > 0 &&
      this.is4hChangeTime &&
      this.tradeTime15mCycle === 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio > 35 &&
      this.analysisInfo15m.highOpenRate > 40 &&
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo15m.ema5A10A20Days === 1 &&
      this.analysisInfo15m.ema5A20Days === 1 &&
      this.analysisInfo15m.ema10A20Days === 1 &&
      // 或者4
      this.analysisInfo15m.macdUpDays <= 8
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-7', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio >= 30 &&
      this.analysisInfo15m.netChangeRatio < 50 &&
      this.is4hChangeTime &&
      this.analysisInfo15m.ema5W10A20Days >= 24
    ) {
      // QUSDT，2025/9/9 04:00
      this.setSellByReason('sellIfOnlyPingByReason-28', {
        level: 100,
        useRawPosition: true,
        useMaxPosition: this.analysisInfo15m.ema5W10A20Days >= 32 &&
          this.is4hLastTime
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio > 25 &&
      // 或者250
      this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 200 &&
      this.analysisInfo15m.ema5W10A20Days >= 32
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-9', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者40
      this.analysisInfo15m.netChangeRatio >= 35 &&
      this.analysisInfo15m.macdUpDays === 1 &&
      // 或者60
      this.analysisInfo15m.ema5W10A20Days >= 54
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-3', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      (
        this.analysisInfo15m.netChangeRatioList[0] >= 20 &&
        this.analysisInfo15m.netChangeRatioList[1] >= 25
      ) ||
      (
        this.analysisInfo15m.netChangeRatioList[1] >= 20 &&
        this.analysisInfo15m.netChangeRatioList[0] >= 25
      )
    ) {
      // 暂时没有用最大仓位，观察一下效果先
      this.setSellByReason('sellIfOnlyPingByReason-21', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo1h.ema5W10A20Days >= 64 &&
      this.analysisInfo1h.highLowRate >= 60 &&
      this.analysisInfo1h.netChangeRatio > 45 &&
      !this.marketFlagInfo.isMarketLittleGoodUp &&
      this.tradeTime15mCycle === 4
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-8-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio >= 50 &&
      this.analysisInfo15m.highLowRate / avRate >= 50 &&
      this.analysisInfo15m.ema5A10A20Days >= 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-2', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio >= 40 &&
      !this.marketFlagInfo.isMarketLittleGoodUp &&
      this.analysisInfo15m.macdUpDays < 12 &&
      this.analysisInfo15m.ema5W10B20Days < 12 &&
      this.analysisInfo15m.ema5A10A20Days >= 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-3-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo1h.netChangeRatio >= 40 &&
      this.analysisInfo1h.kdjUpDays === 1 &&
      // 或者129天
      this.analysisInfo1h.ema5W10A20Days >= 32 &&
      // 或者870
      this.analysisInfo1h.ema5W10A20KeepInfo.maxCloseRate >= 200 &&
      // 或者68
      this.analysisInfo4h.netChangeRatio >= 60 &&
      // 或者40
      this.analysisInfo4h.ema5W10A20Days >= 12 &&
      // 或者80
      this.analysisInfo15m.ema5W10A20Days >= 32 &&
      // 或者530
      this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 100 &&
      this.analysisInfo15m.netChangeRatioList[1] >= 12 &&
      this.analysisInfo15m.netChangeRatioList[0] >= 12
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0002', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
  },
  // 5<20;5<10&&macd<0
  sellIfOnlyPingByReasonSmall () {
    if (
      this.analysisInfo15m.ema5W10A20Days >= 32 &&
      this.analysisInfo15m.highOpenRate >= 15 &&
      // 后续可能是15
      this.analysisInfo15m.netChangeRatio > 10 &&
      ((this.analysisInfo15m.netChangeRatio / this.analysisInfo15m.ema5W10A20Rate) > 0.5)
    ) {
      // 暂时没有用最大仓位，观察一下效果先
      this.setSellByReason('sellIfOnlyPingByReason-17', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      this.analysisInfo15m.netChangeRatio < 0 &&
      this.analysisInfo15m.kdjDownDays === 1 &&
      this.analysisInfo15m.lastKdjUpDays === 1 &&
      this.analysisInfo15m.ema5A10A20Days >= 1 &&
      this.analysisInfo15m.ema5W10A20Days >= 32 &&
      this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 40 &&
      this.analysisInfo15m.macd > 0 &&
      this.analysisInfo15m.isMacdDecline &&
      this.is4hChangeTime &&
      this.tradeTime15mCycle === 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-2', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      // 或者35
      this.analysisInfo15m.netChangeRatio >= 30 &&
      this.analysisInfo15m.kdjUpDays === 1 &&
      this.analysisInfo15m.macdUpDays === 1 &&
      // 或者54
      this.analysisInfo15m.ema5W10A20Days >= 32
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-4', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
      if (this.is4hLargeChangeTime) {
        this.setSellByReason('sellIfOnlyPingByReason-p-4-1', {
          level: 100,
          rate: 1,
          useRawPosition: true,
          useMaxPosition: true
        })
      }
    }
    // 涨很久了还冲高的卖出
    if (
      this.analysisInfo15m.ema5W10A20Days >= 72 &&
      this.analysisInfo15m.highOpenRate >= 15 &&
      this.analysisInfo15m.netChangeRatio > 10 &&
      !this.marketFlagInfo.isMarketLittleGoodUp &&
      this.analysisInfo15m.macd < 0
    ) {
      // 这个可能可以一直拿到5<20
      this.setSellByReason('sellIfOnlyPingByReason-8-0', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.marketInfo.kdj4hBad &&
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo4h.kdjUpDays <= 1 &&
      this.analysisInfo15m.netChangeRatio >= 12 &&
      this.analysisInfo15m.macdUpDays <= 5 &&
      this.analysisInfo15m.netChangeRatio2Days >= 20 &&
      (
        (
          this.analysisInfo15m.netChangeRatioList[0] >= 8 &&
          this.analysisInfo15m.netChangeRatioList[1] >= 12
        ) ||
        (
          this.analysisInfo15m.netChangeRatioList[1] >= 8 &&
          this.analysisInfo15m.netChangeRatioList[0] >= 12
        )
      )
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0003', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者165
      this.analysisInfo15m.lastKdjUpKeepInfo.maxHighRate >= 140 &&
      this.analysisInfo15m.kdjDownDays === 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0009', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
  },
  // 5<20&&macd<0
  sellIfOnlyPingByReasonNormal () {
    if (
      this.analysisInfo15m.ema5W10A20Days >= 16 &&
      this.analysisInfo15m.netChangeRatio >= 35 &&
      this.analysisInfo15m.ema5W10A20KeepInfo.maxHighRate >= 200 &&
      this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 200
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-27', {
        level: 100,
        useRawPosition: true,
        useMaxPosition: this.analysisInfo15m.ema5W10A20KeepInfo.maxHighRate >= 300 &&
          this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 280
      })
    }
    if (
      this.tradeTime15mCycle === 1 &&
      this.analysisInfo15m.netChangeRatio >= 5 &&
      this.analysisInfo15m.isKdjDecline &&
      (
        (
          this.analysisInfo1h.netChangeRatioList[1] >= 15 &&
          this.analysisInfo1h.netChangeRatioList[2] >= 25
        ) ||
        (
          this.analysisInfo1h.netChangeRatioList[1] >= 25 &&
          this.analysisInfo1h.netChangeRatioList[2] >= 15
        )
      )
      // 或者判断大于100
      // this.btbItem.price_change_percent > 100
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0004', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo15m.netChangeRatio > 0 &&
      // 或者加上是第一天
      this.analysisInfo15m.isMacdDecline &&
      (
        this.analysisInfo1h.netChangeRatioList[0] >= 12 &&
        this.analysisInfo1h.netChangeRatioList[1] >= 12 &&
        this.analysisInfo1h.netChangeRatioList[2] >= 12
      ) &&
      (
        (
          this.analysisInfo4h.netChangeRatioList[0] >= 20 &&
          // 或者35
          this.analysisInfo4h.netChangeRatioList[1] >= 30
        ) ||
        (
          this.analysisInfo4h.netChangeRatioList[0] >= 30 &&
          this.analysisInfo4h.netChangeRatioList[1] >= 20
        )
      )
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0005', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.tradeTime15mCycle === 1 &&
      this.analysisInfo15m.netChangeRatio > 0 &&
      // 或者加上是第一天
      this.analysisInfo15m.isMacdDecline &&
      (
        this.analysisInfo1h.netChangeRatioList[1] >= 12 &&
        this.analysisInfo1h.netChangeRatioList[2] >= 12 &&
        this.analysisInfo1h.netChangeRatioList[3] >= 12
      ) &&
      (
        (
          (
            this.analysisInfo4h.netChangeRatioList[0] >= 20 &&
            // 或者35
            this.analysisInfo4h.netChangeRatioList[1] >= 30
          ) ||
          (
            this.analysisInfo4h.netChangeRatioList[0] >= 30 &&
            this.analysisInfo4h.netChangeRatioList[1] >= 20
          )
        ) ||
        (
          this.is4hChangeTime &&
          (
            (
              this.analysisInfo4h.netChangeRatioList[1] >= 20 &&
              // 或者35
              this.analysisInfo4h.netChangeRatioList[2] >= 30
            ) ||
            (
              this.analysisInfo4h.netChangeRatioList[1] >= 30 &&
              this.analysisInfo4h.netChangeRatioList[2] >= 20
            )
          )
        )
      )
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0006', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
  },
  // 5<10<20
  sellIfOnlyPingByReasonBig () {
    if (
      this.analysisInfo15m.highOpenRate >= 50 &&
      this.analysisInfo15m.netChangeRatio < (this.analysisInfo15m.highOpenRate * 0.5) &&
      this.analysisInfo15m.kdjDiff < 0 &&
      this.analysisInfo15m.kdjDownDays === 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-23', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者小于-40
      this.analysisInfo15m.netChangeRatio <= -35 &&
      this.analysisInfo15m.ema5A10A20Days >= 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-b-1', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      // 或者12
      this.analysisInfo1d.ema5B10B20Days >= 3 &&
      this.analysisInfo1d.macd < 0 &&
      // 或者加上isUSDayChangeTime
      this.is4hLastTime &&
      this.analysisInfo1h.kdjUpDays === 1 &&
      this.analysisInfo1h.macd < 0 &&
      this.analysisInfo1h.ema5A20Days <= 1 &&
      this.analysisInfo15m.macdUpDays === 1 &&
      this.analysisInfo15m.kdjDiff > 0 &&
      this.analysisInfo15m.kdjUpDays <= 2 &&
      this.analysisInfo15m.ema5A20Days === 1 &&
      this.analysisInfo15m.ema5A10Days === 1 &&
      // 或者25
      this.analysisInfo15m.highOpenRate >= 20 &&
      this.analysisInfo15m.netChangeRatio >= 12.5
      // 下面这个看看要不要加上
      // // 或者0.6
      // (this.analysisInfo15m.netChangeRatio / this.analysisInfo15m.highOpenRate) <= 0.8
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-10', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      this.is4hImportantChangeTime &&
      this.tradeTime15mCycle === 1 &&
      this.analysisInfo15m.kdjDownDays === 1 &&
      this.analysisInfo15m.isMacdDecline &&
      this.analysisInfo15m.netChangeRatio < 0 &&
      this.analysisInfo15m.ema5A10A20Days >= 1 &&
      this.analysisInfo1d.macdUpDays <= 1 &&
      // 或者95
      this.analysisInfo15m.ema5W10A20Days >= 80
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0007', {
        level: 100,
        rate: 1,
        useRawPosition: true
        // useMaxPosition: true
      })
    }
  },
  // 5<10<20配合其他的
  sellIfOnlyPingByReasonLarge () {
    if (
      this.analysisInfo15m.ema5W10A20Days >= 120 &&
      this.analysisInfo15m.macdDownDays >= 8 &&
      this.analysisInfo15m.kdjDiff > 0 &&
      this.analysisInfo15m.kdjUpDays <= 4 &&
      this.is4hChangeTime
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-24', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      // 或者48以上
      this.analysisInfo15m.ema5W10A20Days >= 12 &&
      // 或者rate就大于220了
      this.analysisInfo15m.ema5W10A20KeepInfo.maxHighRate >= 200 &&
      this.analysisInfo15m.macdDownDays >= 10 &&
      this.analysisInfo15m.kdjDiff > 0 &&
      this.analysisInfo15m.kdjUpDays <= 4 &&
      this.analysisInfo1h.kdjDiff < 0
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-25', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者大于250
      this.analysisInfo1h.ema5W10A20KeepInfo.maxHighRate >= 200 &&
      this.analysisInfo1h.ema5W10A20Days >= 48 &&
      this.analysisInfo1h.macdDownDays >= 24 &&
      this.analysisInfo1h.kdjDownDays <= 2 &&
      this.analysisInfo1h.ema5B10Days >= 6 &&
      this.analysisInfo4h.kdjDiff < 0 &&
      this.analysisInfo4h.isMacdDecline
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-26', {
        level: 100,
        useRawPosition: true
      })
    }
    if (
      this.tradeTime15mCycle === 1 &&
      this.analysisInfo15m.kdjDownDays === 1 &&
      this.analysisInfo15m.macd > 0 &&
      this.analysisInfo15m.ema5A10A20Days >= 1 &&
      this.analysisInfo15m.lowOpenRate < -30 &&
      this.analysisInfo15m.netChangeRatio < -15 &&
      this.analysisInfo15m.netChangeRatio > -23 &&
      // 一波涨了200，并且ema80天以上了
      this.analysisInfo15m.ema5W10A20KeepInfo.maxCloseRate >= 100 &&
      this.analysisInfo15m.ema5W10A20Days >= 48
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-5', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者40
      this.analysisInfo15m.netChangeRatio > 35 &&
      // 或者55
      this.analysisInfo15m.highOpenRate > 45 &&
      this.analysisInfo15m.kdjDiff < 0 &&
      // 或者68
      this.analysisInfo15m.ema5W10A20Days >= 32
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-6', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
      if (this.analysisInfo15m.ema5W10A20Days >= 48) {
      }
    }
    if (
      this.analysisInfo1h.ema5W10A20KeepInfo.maxCloseRate >= 100 &&
      this.analysisInfo1h.kdjDownDays >= 1 &&
      this.analysisInfo1h.lastKdjUpDays >= 12 &&
      this.analysisInfo1h.ema5W10B20Days >= 1 &&
      this.analysisInfo1h.macd > 0 &&
      // 20天里面19天在下面
      this.analysisInfoFlag15m.countKdjDownTimes(16) >= 15 &&
      this.analysisInfo15m.kdjDiff < 0 &&
      // 15
      this.analysisInfo15m.macdDownDays >= 12 &&
      // 68天
      this.analysisInfo15m.ema5W10B20Days >= 48
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-8', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    if (
      // 或者55
      this.analysisInfo15m.highOpenRate > 40 &&
      // 或者小于5
      this.analysisInfo15m.netChangeRatio < 7.5 &&
      this.analysisInfo15m.netChangeRatio > 0 &&
      this.analysisInfo15m.ema5W10B20Days === 0
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-p-11', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo15m.lastEma5A10Days >= 36 &&
      this.analysisInfo15m.ema5W10A20Days >= 36 &&
      // 或者得大于90
      this.analysisInfo15m.ema5W10A20Rate >= 40 &&
      this.analysisInfo15m.ema5B10Days >= 6 &&
      this.analysisInfo15m.macd < 0 &&
      this.analysisInfo15m.kdjDiff < 0
    ) {
      // 暂时没有用最大仓位，观察一下效果先
      this.setSellByReason('sellIfOnlyPingByReason-19', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      this.analysisInfo1h.lastEma5W10A20Days >= 44 &&
      this.analysisInfo1h.macdDownDays >= 12 &&
      this.analysisInfo15m.ema5W10A20Days >= 36 &&
      this.analysisInfo15m.macdUpDays <= 4 &&
      this.is4hChangeTime
    ) {
      // 暂时没有用最大仓位，观察一下效果先
      this.setSellByReason('sellIfOnlyPingByReason-20', {
        level: 100,
        rate: 1,
        useRawPosition: true
      })
    }
    const is15mCloseDown = this.analysisInfo15m.close < this.analysisInfo15m.ema5 &&
      this.analysisInfo15m.close < this.analysisInfo15m.ema10 &&
      this.analysisInfo15m.close < this.analysisInfo15m.ema20 &&
      numberUtil.countDifferenceRate(this.analysisInfo15m.ema5, this.analysisInfo15m.ema20) < 0.1 &&
      this.analysisInfo15m.ema5 < this.analysisInfo15m.ema10
    if (
      this.analysisInfo15m.macd < 0 &&
      this.analysisInfo15m.macdDownDays > 16 &&
      this.analysisInfo15m.ema5W10A20Days >= 80 &&
      (this.analysisInfo15m.kdjDiff > 0 || this.analysisInfo15m.netChangeRatioUpDays >= 2 || this.symbolAccount.maxStandardPosition < 0.35) &&
      this.analysisInfo1h.kdjDiff < 0 &&
      this.analysisInfo1h.macd < 0 &&
      !is15mCloseDown &&
      // !this.marketFlagInfo.indexIfMarketUpTrend &&
      // !this.marketFlagInfo.ifMarket4hMacdEmaAllGood &&
      // 其实挺好的(出现浮亏是因为卖出了市场上最强的币，而且还有马斯克在喊单,即使这样，最后也还是可以盈利走掉的)
      this.btbItem.price_change_percent < 100
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-6', {
        level: 100,
        useRawPosition: true
        // 分两次买
      })
    }
    if (
      this.analysisInfo15m.macd < 0 &&
      this.analysisInfo15m.macdDownDays >= 24 &&
      this.analysisInfo15m.ema5W10A20Days >= 64 &&
      (this.analysisInfo15m.kdjDiff > 0 || this.analysisInfo15m.netChangeRatioUpDays >= 2 || this.symbolAccount.maxStandardPosition < 0.35) &&
      this.analysisInfo1h.kdjDiff < 0 &&
      !is15mCloseDown &&
      (
        (this.marketFlagInfo.indexIfMarketUpTrend || this.marketFlagInfo.ifMarket4hMacdEmaAllGood)
          ? (this.analysisInfo15m.macdDownDays >= 32 || this.analysisInfo1h.macd < 0) : true
      ) &&
      // 其实挺好的(出现浮亏是因为卖出了市场上最强的币，而且还有马斯克在喊单,即使这样，最后也还是可以盈利走掉的)
      this.btbItem.price_change_percent < 100
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-7', {
        level: 100,
        useRawPosition: true
        // 分两次买
      })
    }
    if (
      this.analysisInfo15m.macd < 0 &&
      this.analysisInfo15m.macdDownDays >= 32 &&
      this.analysisInfo15m.ema5W10A20Days >= 52 &&
      this.analysisInfo1h.kdjDiff < 0 &&
      this.analysisInfo1h.isMacdDecline &&
      this.btbItem.price_change_percent < 100 &&
      (this.analysisInfo15m.kdjDiff > 0 || this.analysisInfo15m.netChangeRatioUpDays >= 2 || this.symbolAccount.maxStandardPosition < 0.35)
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-7-1', {
        level: 100,
        useRawPosition: true
        // 分两次买
      })
    }
    if (
      this.marketInfo.kdj4hBad &&
      this.tradeTime15mCycle === 4 &&
      this.analysisInfo15m.netChangeRatio >= 12 &&
      this.analysisInfo15m.netChangeRatioList[1] >= 12 &&
      this.analysisInfo15m.macdUpDays <= 3 &&
      this.analysisInfo4h.close > this.analysisInfo4h.ema20 &&
      // 实际情况是5大于20第一天，然后上个20105有46天，PUMPBTC 2025/9/30 18:00:00
      (
        (this.analysisInfo4h.ema5W10B20Days >= 12) ||
        (this.analysisInfo4h.ema5A20Days === 1 && this.analysisInfo4h.lastEma5W10B20Days >= 12)
      ) &&
      this.btbItem.price_change_percent < 70
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0001', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
  },
  sellIfOnlyPingByReason1h () {
    if (
      this.analysisInfo1h.lastKdjUpDays >= 20 &&
      this.analysisInfo1h.kdjDownDays <= 2 &&
      this.analysisInfo1h.kdjDiff < 0 &&
      this.analysisInfo1h.ema5 > this.analysisInfo1h.ema20 &&
      this.tradeTime15mCycle === 4
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0008', {
        level: 800,
        rate: 0.5,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    if (
      // 或者760
      this.analysisInfo1h.lastKdjUpKeepInfo.maxHighRate >= 500 &&
      this.analysisInfo1h.kdjDownDays <= 2 &&
      this.analysisInfo1h.kdjDiff < 0 &&
      this.analysisInfo1h.ema5 > this.analysisInfo1h.ema20 &&
      this.tradeTime15mCycle === 4
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-0010', {
        level: 800,
        rate: 0.5,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
  },
  sellIfOnlyPingByReasonPreTest () {
    let avRate = this.analysisInfo15m.before10DaysAvMaxWave
    if (avRate < 0.3) {
      avRate = 0.3
    }
    if (
      this.analysisInfo15m.lastKdjUpRate >= 200 &&
      this.analysisInfo15m.kdjDownDays <= 2
    ) {
      // 暂时没有用最大仓位，观察一下效果先
      this.setSellByReason('sellIfOnlyPingByReason-18', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
    // 有点复杂
    if (
      // vine的2025/8/3 1:30那种形态
      this.analysisInfo15m.netChangeRatio < 0 &&
      this.analysisInfo15m.highOpenRate / avRate > 20 &&
      this.analysisInfo15m.highOpenRate > 25 &&
      !(this.marketInfo.k15mNetChangeRatio < -10)
      // this.analysisInfo15m.lowOpenRate < -7
      // （也可以加入15是kong的判断，当时小时的ema和4h的ema也都是下面）
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-15', {
        level: 100,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true
      })
    }
  },
  sellIfOnlyPingByReasonSpecial () {
    if (
      this.analysisInfo15m.netChangeRatio >= 70 &&
      // 防止-70然后涨100的情况
      this.analysisInfo15m.ema5A10A20Days >= 1
    ) {
      this.setSellByReason('sellIfOnlyPingByReason-3', {
        level: 900,
        rate: 1,
        useRawPosition: true,
        useMaxPosition: true,
        leverage: 3
      })
    }
  },
  sellIfOnlyPingByReason () {
    this.sellIfOnlyPingByReasonPingNextKline()
    this.sellIfOnlyPingByReasonMini()
    this.sellIfOnlyPingByReasonSmall()
    this.sellIfOnlyPingByReasonPreTest()
    this.sellIfOnlyPingByReasonNormal()
    this.sellIfOnlyPingByReasonBig()
    this.sellIfOnlyPingByReasonLarge()
    this.sellIfOnlyPingByReason1h()
    this.sellIfOnlyPingByReasonSpecial()
  },
  sellIfStepBack () {
    if (this.marketInfo && this.marketInfo.kdj4hBad && (this.marketFlagInfo.marketKdj4hBadDays >= 6 || this.marketInfo.macd4hBad)) {
      if (
        this.analysisInfo4h.kdjDiff < 0 &&
        !(this.marketInfo.ema4hGood || this.marketInfo.macd4hGood) &&
        this.marketFlagInfo.ifMarket15mMacdEmaAllGood &&
        (this.marketInfo.ema1hBad || this.marketInfo.macd1hBad)
      ) {
        if (this.analysisInfo1h.macd < 0 && this.analysisInfo1h.ema5B10Days >= 3) {
          if (this.analysisInfo15m.ema5W10B20Days >= 7 && this.analysisInfo15m.ema5A20Days <= 6) {
            // 好像没啥问题，因为大涨以后回落，反弹的时候回踩，我去开空也在挣钱了
            // TODO 就算短期仓位可能亏钱，但最终卖出的时候好像都是挣钱的
            if (this.analysisInfo15m.netChangeRatioUpDays >= 3 && this.analysisInfo15m.macd > 0) {
              // 2025/8/15一开始亏挺多，结果最后平仓的时候挣得还可以
              this.setSell('sellIfStepBack-1', {
                rate: 0.5,
                coverPositionConfig: 0.66
              })
              this.ifOnlyPingKongByReason = true
              // this.buySellRawTotalWalletBalance = true
            }
            // 确实很容易在中间出现亏钱
            if (
              (this.analysisInfo15m.close > this.analysisInfo15m.ema20 && this.analysisInfo15m.netChangeRatio > 0) ||
              (this.analysisInfo15m.ema5 > this.analysisInfo15m.ema10 && this.analysisInfo15m.close > this.analysisInfo15m.ema10 && this.analysisInfo15m.netChangeRatioUpDays >= 2)
            ) {
              // 2025/8/15一开始亏挺多，结果最后平仓的时候挣得还可以
              this.setSell('sellIfStepBack-2', {
                rate: 0.5,
                coverPositionConfig: 0.66
              })
              this.ifOnlyPingKongByReason = true
              // this.buySellRawTotalWalletBalance = true
            }
          }
        }
      }
    }
  }
}
